package com.zretc.entity;

/**
 * @author 周文涛
 * 2020年8月21日13:52:41
 * 响应结果类
 */
public class ResponseResult {

    private Integer status; // 响应状态
    private String message; // 响应消息
    private Object object; // 响应数据

    /**
     * @return 初始化的响应类
     */
    public static ResponseResult build() {
        return new ResponseResult();
    }

    /**
     * @param message 响应的消息
     * @return 成功响应，无数据
     */
    public static ResponseResult ok(String message) {
        return new ResponseResult(200, message, null);
    }

    /**
     * @param msg 响应的消息
     * @param obj 响应的数据
     * @return 成功的响应
     */
    public static ResponseResult ok(String msg, Object obj) {
        return new ResponseResult(200, msg, obj);
    }

    /**
     * @param msg 错误的响应消息
     * @return 错误的响应，无参
     */
    public static ResponseResult error(String msg) {
        return new ResponseResult(500, msg, null);
    }

    /**
     * @param msg 错误的响应消息
     * @param obj 错误的响应数据
     * @return 错误的响应
     */
    public static ResponseResult error(String msg, Object obj) {
        return new ResponseResult(500, msg, obj);
    }


    public ResponseResult() {
    }

    public ResponseResult(Integer status, String message, Object object) {
        this.status = status;
        this.message = message;
        this.object = object;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getObject() {
        return object;
    }

    public void setObject(Object object) {
        this.object = object;
    }
}
